package _4_strategy_method

import "fmt"

type MemberLevel int

const (
	L1 = iota
	L2
	L3
)

type Member struct {
	Level MemberLevel
	Name  string
}

type MemberAwardService interface {
	send(member Member)
}

type L1MemberAwardService struct {
}

func (l *L1MemberAwardService) send(member Member) {
	fmt.Println("send award for l1 member")
}

type L2MemberAwardService struct {
}

func (l *L2MemberAwardService) send(member Member) {
	fmt.Println("send award for l2 member")
}

type L3MemberAwardService struct {
}

func (l *L3MemberAwardService) send(member Member) {
	fmt.Println("send award for l3 member")
}

type MemberAwardServiceFactory struct {
	services map[MemberLevel]MemberAwardService
}

func NewMemberAwardServiceFactory() MemberAwardServiceFactory {
	return MemberAwardServiceFactory{
		services: map[MemberLevel]MemberAwardService{
			L1: &L1MemberAwardService{},
			L2: &L2MemberAwardService{},
			L3: &L3MemberAwardService{},
		},
	}
}

func (f *MemberAwardServiceFactory) getMemberAwardService(memberLevel MemberLevel) MemberAwardService {
	return f.services[memberLevel]
}
